#include"Comm.hpp"

int main(){
    //启动服务
    CreateNamedPipe(FILE_PATH);
    //进行通信
    int fd = open(FILE_PATH,O_WRONLY);
    char buffer[1024];
    while (true){
        std::cout<<"--->";
        fgets(buffer,sizeof(buffer),stdin);
        buffer[strlen(buffer)-1] = 0;
        ssize_t s = write(fd,buffer,strlen(buffer));
        assert(s == strlen(buffer));
    }
    //结束通信
    close(fd);
    RemoveNamedPipe(FILE_PATH);
    return 0;
}
